<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>
        床位添加
    </title>
    <style>
        .dd {
            text-indent: 2em;
            text-align: center;
            margin-top: 20px;
        }
        tr{height: 30px}
        table{margin-top: 20px}
    </style>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="../css/x-admin.css" media="all">
    <link rel="stylesheet" href="../css/pag.css" media="all">
    <link type="text/css" rel="stylesheet" href="../js/jedate/test/jeDate-test.css">
    <link type="text/css" rel="stylesheet" href="../js/jedate/skin/jedate.css">
    <script type="text/javascript" src="../js/jedate/src/jedate.js"></script>
</head>
<body>
<div class="dd">
    <form id="bedAdd" action="/bedAddInfo" method="post">
        <input type="hidden" name="bState" value="2">
        <table>
            <tr class="mes">
                <td>所属科室：</td>
                <td>
                    <select name="kNo" id="kNo" style="width: 145px;">
                        <option value="0" selected="selected">---请选择---</option>
                        <c:forEach var="keshi" items="${keshiList}">
                            <option value="${keshi.kid}">${keshi.kname}</option>
                        </c:forEach>
                    </select>
                </td>
            </tr>
            <tr class="mes">
                <td>床位号：</td>
                <td><input name="bNo" id="bNo" type="text" value=""></td>
                <td><span id="bo"><font color="red"></font></span></td>
            </tr>
            <tr class="mes">
                <td>床位价格：</td>
                <td><input type="text" name="bPay" value=""></td>
            </tr>

        </table>
        <div class="layui-form-item">
            <label class="layui-form-label">
            </label>
            <button class="layui-btn" type="submit" style="margin-top: 20px;margin-left: -110px">
                确定
            </button>
        </div>
    </form>
</div>

<script src="../lib/layui/layui.js" charset="utf-8"></script>
<script src="../js/x-layui.js" charset="utf-8"></script>
<script src="../js/jquery2.js" charset="utf-8"></script>
<script src="../js/js.js" charset="utf-8"></script>
<script>
    layui.use(['laydate', 'element', 'laypage', 'layer'], function () {
        $ = layui.jquery;//jquery
        lement = layui.element();//面包导航
        laypage = layui.laypage;//分页
        layer = layui.layer;//弹出层

    });

    // $(".layui-btn").bind("click", function () {
    //     $("#doForm").submit();
        // var index = parent.layer.getFrameIndex(window.name);
    // parent.location.href="zyhl";
    // parent.layer.close(index);
    // })
    $('tr:odd').addClass('odd');


    $("#bNo").blur(function () {
        var bNo = $("#bNo").val();
        $.ajax({
            type:"get",
            url:"/bedNo?bNo="+bNo,
            // date:{userId:userId},
            dateType:"json",
            success:function(data){
                var flag = data.retMsg;
                if (flag){
                    $("#bo").css({"color":"green"}).html("✔");
                }else {
                    $("#bo").css({"color":"red"}).html("该床号已存在");
                }
            },
            error:function () {
                $("#bo").css({"color":"red"}).html("请输入床位号");
            }
        });
    })
</script>
</body>
</html>